<?php
/**
 * Created by PhpStorm.
 * User: changshuiwang
 * Date: 2016/7/27
 * Time: 11:36
 */


use yii\grid\GridView;
use yii\helpers\Html;
use backend\config\ScoreDef;
use backend\config\StudentDef;



use backend\assets\AppAsset;
AppAsset::register($this);
//AppAsset::addJs($this,"/js/delete.js");
//AppAsset::addCss($this,Yii::$app->request->baseUrl."/css/b.css");

?>
<style>
    input[type="text"]{
        height:34px;
    }
    .row{
        margin-left: 0px;
    }
</style>
<script src="/js/jquery-1.9.1.min.js"></script>
<script src="/js/layer/layer.js"></script>
    <script src="/js/score/add.js"></script>
<div id="content">
    <div id="content-header">
        <div id="breadcrumb"> <a href="/site/index" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a>
            <a href="#" class="tip-bottom">manage</a></div>
    </div>

    <div class="widget-box">
        <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
            <h5>学生成绩列表</h5>
            <span class="left-title " style="float: right"><a href="javascript:void(0)" class="btn btn-info upload-score"><i class="icon-plus"></i>上传成绩</a></span>
        </div>
        <div class="widget-content nopadding">

        </div>
        <!--<div class="site-login">
            <h1><?/*= Html::encode($this->title) */?></h1>

            <p>搜索栏</p>

            <div class="row">
                <div class="col-lg-5">
                    <form id="login-form" method="get" role="form">

                        <div class="form-group field-searchform-username">
                            <label class="control-label" for="searchform-username">Username</label>
                            <input type="text" id="searchform-username" class="form-control" name="SearchForm[username]">

                            <p class="help-block help-block-error"></p>
                        </div>


                        <div class="form-group field-searchform-score">
                            <label class="control-label" for="searchform-score">Score</label>
                            <select id="searchform-score" class="form-control" name="SearchForm[score]">
                                <option value="0">请选择分数</option>
                                <option value="a">小于60分</option>
                                <option value="b">60-70分</option>
                                <option value="c">70-80分</option>
                                <option value="d">80-90分</option>
                                <option value="e">90分以上</option>
                            </select>

                            <p class="help-block help-block-error"></p>
                        </div>

                        <div><label style="display: inline-block;"><input type="radio" name="tag" value="0" checked=""> 全部</label>
                            <label style="display: inline-block;"><input type="radio" name="tag" value="1"> 已删除</label>
                            <label style="display: inline-block;"><input type="radio" name="tag" value="2"> 未删除</label>
                        </div>

                        <div class="form-group">
                            <button type="submit" class="btn btn-primary filter" name="login-button">Search</button>
                        </div>

                    </form>
                </div>
            </div>
        </div>-->
        <!--<p style="margin-left: 20px;"><a class="btn btn-lg btn-success" href="<?/*=Yii::$app->urlManager->createUrl('site/add')*/?>">添加</a></p>-->
        <?php
        echo GridView::widget([
            'dataProvider' => $dataProvider,
            'columns' => [
                [
                    'header'=>'学生id',
                    'attribute'=>'id',
                    'value' => function($model){
                        return $model['id'];
                    }
                ],
                [ 'attribute' => 'status','value' => function($model) {
                    $status=$model['status'];
                    return StudentDef::$status_arr[$status];
                }],
                //'stu_id',
                [ 'attribute' => 'type','value' => function($model) {
                    $type=$model['type'];
                    return ScoreDef::$type_arr[$type];
                    //return $type;
                }],
                'score',
                [
                    'class' => 'yii\grid\ActionColumn',
                    'header' => '操作',
                    'template' => '{update}',
                    'buttons' => [
                        'update' => function ($url, $model, $key) {
                            return Html::a("<span class='glyphicon glyphicon-pencil' id=$model[sc_id] status=$model[status] </span>", "javascript:void(0)" );
                        },
                    ],
                ],

            ]
        ]);
        ?>
    </div>
</div>